﻿using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;

namespace FishSimulation.Model
{
    public class Legend
    {
        public System.Windows.Media.SolidColorBrush Color
        {
            get;
            set;
        }

        public int Count
        {
            get;
            set;
        }

        public string Text
        {
            get;
            set;
        }

        public static List<Legend> Create() {
            List<Legend> result = new List<Legend>();

            foreach (var type in Repository.Instance.GetActorTypes()) {
                Legend l = new Legend();
                l.Color = type.Color;
                l.Text = type.Name;
                l.Count = Repository.Instance.World.Actors.Where(x => x.ActorTypeId.CompareString(type.Id)).Count();
                result.Add(l);
            }

            return result;
        }
    }
}
